<?php
	$css_list[0]['url'][] = './tpl/css/book.css';
	$css_list[0]['url'][] = './tpl/css/search.css';
	$js_list[0] = './public/js/jquery.masonry.js';
?>
<!--{template inc/header_w}-->
<div class="main_body">
    <!--{template inc/search_tabs}-->
    <div class="wf_filter">
    <!--   <a href="/search.php?word={$keyword}&action=product&order=sharenum" class="a1{if $orderkey=='sharenum'} current{/if}" title="按分享数从高到低">{if $orderkey=='sharenum'}分享数从高到低{else}分享数{/if}</a>
        <a href="/search.php?word={$keyword}&action=product&order=commentnum" class="a1{if $orderkey=='commentnum'} current{/if}" title="按评论数从高到低">{if $orderkey=='commentnum'}评论数从高到低{else}评论数{/if}</a>  -->
        <div class="i_sele" id="selePrice">
            <a href="#" class="a1{if $orderkey=='pricedown' || $orderkey=='priceup'} current{/if}"><span{if $orderkey=='pricedown' || $orderkey=='priceup'} style="color:#f40;"{/if}>{if $orderkey=='priceup'}价格从低到高{elseif $orderkey=='pricedown'}价格从高到低{else}价格{/if}</span><em class="ui"></em></a>
            <div class="j_menu" id="selePriceMenu">
                <ul>
                    <li><a href="/search.php?word={$keyword}&action=product&order=priceup">价格从低到高</a></li>
                    <li><a href="/search.php?word={$keyword}&action=product&order=pricedown">价格从高到低</a></li>
                </ul>
            </div>
        </div>
        <form action="/search.php">
            <div class="i_price">
                <input type="text" name="minprice" class="j_ipt" size="4" value="{$minprice}" /> - <input type="text" name="maxprice" class="j_ipt" size="4" value="{$maxprice}" />
                <input type="submit" class="j_btn" value="确认" />
                <input type="hidden" name="action" value="product"/>
                <input type="hidden" name="word" value="{$keyword}"/>
                <input type="hidden" name="order" value="{$orderkey}"/>
            </div>
        </form>
    </div>
    <div class="wf_list" id="wfContainer">
        
        <!--{loop $products $product}-->
        <div class="item">
            <a href="{u product/show id=$product['id']}" target="_blank" class="a1"><span class="g_radius"><span>评论({$product['comment_count']})</span></span><img src="{$product[img]}" class="wf_img" width="{$product[width]}" height="{$product[height]}" /></a>
            <div class="i_info">
                <a href="{u product/show id=$product['id']}">{$product[title]}</a>
            </div>
        </div>
        <!--{/loop}-->
        
    </div>

    {if empty($products)}
    <div class="no_found">
        <div class="i_center"><img src="/public/v1/img/no_found.gif"><p>未找到与<span>"{$keyword}"</span>相关的信息</p></div>
    </div>
    {/if}

    
</div>


<script>
$('#wfContainer').masonry({
    itemSelector: '.item',
    gutterWidth: 12
});
$(function(){
    

    $(window).resize(function() {
        resize_masonry();
    });

    resize_masonry();
    
    
});

function resize_masonry(){
    var max_width=$('#wfContainer').width();
    var col_num=max_width>1440?7:5;
    var min_gutter=12;
    var item_width=Math.floor((max_width-min_gutter*(col_num-1))/col_num)-2;
    $('#wfContainer .item').css('width',item_width);
    $('#wfContainer .item img').each(function(){
        var b=parseInt($(this).attr('width'))/parseInt($(this).attr('height'));
        var item_height=Math.floor(item_width/b);
        $(this).attr('width',item_width);
        $(this).attr('height',item_height);
    });
    $('#wfContainer').masonry( 'reload' );
}


function appendShareItem(result,index) {
	html = '<div>' + result + '</div>';
    html = $(html).find('.item');
    $('#wfContainer').append(html);
    resize_masonry();
}


</script>
<!--{template inc/footer}-->
